home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form frmNew
- BackColor = &H00008000&
- BorderStyle = 1 'Fixed Single
- ClientHeight = 1305
- ClientLeft = 2700
- ClientTop = 1635
- ClientWidth = 3420
- ControlBox = 0 'False
- Height = 1770
- Icon = 0
- Left = 2610
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 87
- ScaleMode = 3 'Pixel
- ScaleWidth = 228
- Top = 1260
- Width = 3600
- Begin PictureBox picArray
- Height = 100
- Index = 0
- Left = 100
- ScaleHeight = 75
- ScaleWidth = 75
- TabIndex = 3
- Top = 1400
- Width = 100
- End
- Begin PictureBox picArray
- Height = 100
- Index = 1
- Left = 200
- ScaleHeight = 75
- ScaleWidth = 75
- TabIndex = 4
- Top = 1400
- Width = 100
- End
- Begin PictureBox picArray
- Height = 100
- Index = 2
- Left = 300
- ScaleHeight = 75
- ScaleWidth = 75
- TabIndex = 5
- Top = 1400
- Width = 100
- End
- Begin PictureBox picArray
- Height = 100
- Index = 3
- Left = 400
- ScaleHeight = 75
- ScaleWidth = 75
- TabIndex = 6
- Top = 1400
- Width = 100
- End
- Begin ListBox lstReport
- Height = 1200
- Left = 45
- TabIndex = 2
- Top = 45
- Width = 2625
- End
- Begin CommandButton cmdCancel
- Cancel = -1 'True
- Caption = "X"
- Height = 375
- Left = 2745
- TabIndex = 1
- Top = 495
- Width = 600
- End
- Begin CommandButton cmdOK
- Caption = "OK"
- Default = -1 'True
- Height = 375
- Left = 2745
- TabIndex = 0
- Top = 45
- Width = 600
- End
- Option Explicit
- Sub cmdCancel_Click ()
- ShowStatus ("Cancel'd")
- frmBar.Enabled = True
- frmPreview.Show
- Unload frmNew
- End Sub
- Sub cmdOK_Click ()
- Dim iIndex As Integer
- iIndex = lstReport.ListIndex
- Select Case iIndex
- Case 0
- ShowStatus ("Create Report 1")
- Report0
- ShowStatus ("Report 1 created")
- frmBar.Enabled = True
- frmPreview.Show
- frmBar.Show
- Unload frmNew
- Case 1
- Beep
- Case 2
- Beep
- Case Else
- Debug.Print "Error: Wrong list index"
- End Select
- End Sub
- Sub CreateFonts ()
- 'Fill the font array
- Dim uiErr As Integer
- Dim logfont As logfont
- Dim hFont As Integer
- Dim uiCount As Integer
- uiErr = PfoFontArrayCreate(PFO.FontArray)
- If Not uiErr Then
- logfont.lfHeight = 60 'mm/10
- logfont.lfWidth = 0
- logfont.lfEscapement = 0
- logfont.lfOrientation = 0
- logfont.lfWeight = FW_NORMAL
- logfont.lfItalic = Chr(0)
- logfont.lfUnderline = Chr(0)
- logfont.lfStrikeOut = Chr(0)
- logfont.lfCharSet = Chr(ANSI_CHARSET)
- logfont.lfOutPrecision = Chr(OUT_CHARACTER_PRECIS)
- logfont.lfClipPrecision = Chr(CLIP_CHARACTER_PRECIS)
- logfont.lfQuality = Chr(PROOF_QUALITY)
- logfont.lfPitchAndFamily = Chr(VARIABLE_PITCH)
- logfont.lfFaceName = "Arial"
-
- 'Font 1: normal
- hFont = CreateFontIndirect(logfont)
- If hFont = 0 Then Exit Sub
- uiErr = PfoFontArrayAdd(PFO.FontArray, hFont)
- If uiErr Then Exit Sub
-
- 'Font 2: bold, for sub-headings
- logfont.lfWeight = FW_BOLD
- hFont = CreateFontIndirect(logfont)
- If hFont = 0 Then Exit Sub
- uiErr = PfoFontArrayAdd(PFO.FontArray, hFont)
- If uiErr Then Exit Sub
- 'Font 3: larger, bold, for top heading
- logfont.lfHeight = 80
- hFont = CreateFontIndirect(logfont)
- If hFont = 0 Then Exit Sub
- uiErr = PfoFontArrayAdd(PFO.FontArray, hFont)
- If uiErr Then Exit Sub
- 'Some debugging helper functions
- uiErr = PfoFontArrayGetCount(PFO.FontArray, uiCount)
- Debug.Print "uiCount "; uiCount
- uiErr = PfoFontArrayGetAt(PFO.FontArray, 0, hFont)
- Debug.Print "hFont "; hFont
- End If
- End Sub
- Sub Form_Load ()
- ShowStatus ("Choose a report")
- lstReport.Clear
- lstReport.AddItem "Report 1", 0
- lstReport.AddItem "Report 2", 1
- lstReport.AddItem "Report 3", 2
- If PFO.uiType < 3 Then
- lstReport.Selected(PFO.uiType) = True
- Else
- lstReport.Selected(0) = True
- End If
- End Sub
- Sub lstReport_DblClick ()
- Call cmdOK_Click
- End Sub
- Sub Report0 ()
- Dim uiErr As Integer
- Dim item As PFOITEM
- Dim uiCount As Integer
- Dim iOuterLoop, iIndex, iRows As Integer
- Const cszShortText = "This is a short test text."
- Const cszLongText = "123_a_789 123_b_789 123_c_789 123_d_789 123_e_789 123_f_789 123_g_789 123_h_789 123_i_789 123_j_789 123_k_789 123_l_789 123_m_789 123_n_789 123_o_789 123_p_789 123_q_789 123_r_789 123_s_789 123_t_789 123_u_789 123_v_789 123_w_789 123_x_789 "
- Call ClearPFO
- 'Page Layout
- PFO.uiType = 0
- PFO.rcPage.Left = 80
- PFO.rcPage.Top = 80
- PFO.rcPage.right = 1980
- PFO.rcPage.bottom = 2380
- PFO.uiHeaderDY = 100
- PFO.uiFooterDY = 120
- PFO.uiPageToPrint = 1
- Call CreateFonts
- 'Header Array
- uiErr = PfoItemArrayCreate(PFO.ItemArrayHeader)
- If uiErr Then Exit Sub
- item.uiVersion = &H100&
- item.uiYOffs = 0
- item.uiXOffs = 0
- item.uiWidth = 2000
- item.uiHeight = 0
- item.uiType = PFO_FIXSTR
- item.acFixStr = "(#p) Header"
- item.uiFontIdx = 0
- item.uiAlignment = PFO_LEFT
- item.bKeepYPos = True
- item.bBorderLeft = False
- item.bBorderRight = False
- item.bBorderTop = False
- item.bBorderBottom = False
- item.bNewPage = False
- uiErr = PfoItemArrayAdd(PFO.ItemArrayHeader, item)
- If uiErr Then Exit Sub
- item.uiYOffs = 0
- item.uiXOffs = 0
- item.uiWidth = PFO.rcPage.right - PFO.rcPage.Left
- item.uiHeight = 0
- item.uiType = PFO_FIXSTR
- item.acFixStr = "Headertext"
- item.uiFontIdx = 0
- item.uiAlignment = PFO_RIGHT
- item.bKeepYPos = False
- item.bBorderLeft = False
- item.bBorderRight = False
- item.bBorderTop = False
- item.bBorderBottom = False
- item.bNewPage = False
- uiErr = PfoItemArrayAdd(PFO.ItemArrayHeader, item)
- If uiErr Then Exit Sub
- 'Footer Array
- uiErr = PfoItemArrayCreate(PFO.ItemArrayFooter)
- If uiErr Then Exit Sub
- item.uiYOffs = 0
- item.uiXOffs = 0
- item.uiWidth = 2000
- item.uiHeight = 0
- item.uiType = PFO_FIXSTR
- item.acFixStr = "(#p) Footer"
- item.uiFontIdx = 0
- item.uiAlignment = PFO_LEFT
- item.bKeepYPos = True
- item.bBorderLeft = False
- item.bBorderRight = False
- item.bBorderTop = False
- item.bBorderBottom = False
- item.bNewPage = False
- uiErr = PfoItemArrayAdd(PFO.ItemArrayFooter, item)
- If uiErr Then Exit Sub
- item.uiYOffs = 0
- item.uiXOffs = 0
- item.uiWidth = PFO.rcPage.right - PFO.rcPage.Left
- item.uiHeight = 0
- item.uiType = PFO_FIXSTR
- item.acFixStr = "Footer text"
- item.uiFontIdx = 0
- item.uiAlignment = PFO_RIGHT
- item.bKeepYPos = False
- item.bBorderLeft = False
- item.bBorderRight = False
- item.bBorderTop = False
- item.bBorderBottom = False
- item.bNewPage = False
- uiErr = PfoItemArrayAdd(PFO.ItemArrayFooter, item)
- If uiErr Then Exit Sub
- item.uiYOffs = 0
- item.uiXOffs = 0
- item.uiWidth = PFO.rcPage.right - PFO.rcPage.Left
- item.uiHeight = 0
- item.uiType = PFO_FIXSTR
- item.acFixStr = "Footer #p"
- item.uiFontIdx = 0
- item.uiAlignment = PFO_RIGHT
- item.bKeepYPos = False
- item.bBorderLeft = False
- item.bBorderRight = False
- item.bBorderTop = False
- item.bBorderBottom = False
- item.bNewPage = False
- uiErr = PfoItemArrayAdd(PFO.ItemArrayFooter, item)
- If uiErr Then Exit Sub
- 'Body Array
- uiErr = PfoItemArrayCreate(PFO.ItemArrayBody)
- If uiErr Then Exit Sub
- item.uiYOffs = 0
- item.uiXOffs = 0
- item.uiWidth = 2000
- item.uiHeight = 0
- item.uiType = PFO_FIXSTR
- item.acFixStr = "Body"
- item.uiFontIdx = 0
- item.uiAlignment = PFO_LEFT
- item.bKeepYPos = True
- item.bBorderLeft = False
- item.bBorderRight = False
- item.bBorderTop = False
- item.bBorderBottom = False
- item.bNewPage = False
- uiErr = PfoItemArrayAdd(PFO.ItemArrayBody, item)
- If uiErr Then Exit Sub
- item.uiYOffs = 0
- item.uiXOffs = 0
- item.uiWidth = PFO.rcPage.right - PFO.rcPage.Left
- item.uiHeight = 0
- item.uiType = PFO_FIXSTR
- item.acFixStr = "Body text"
- item.uiFontIdx = 0
- item.uiAlignment = PFO_RIGHT
- item.bKeepYPos = False
- item.bBorderLeft = False
- item.bBorderRight = False
- item.bBorderTop = False
- item.bBorderBottom = False
- item.bNewPage = False
- uiErr = PfoItemArrayAdd(PFO.ItemArrayBody, item)
- If uiErr Then Exit Sub
- 'A sequence of mixed tables and texts
- For iOuterLoop = 0 To 4
- item.uiYOffs = iOuterLoop * 333
- item.uiXOffs = 0
- item.uiWidth = 2000
- item.uiHeight = 0
- item.uiType = PFO_FIXSTR
- item.acFixStr = "Caption"
- item.uiFontIdx = 2
- item.uiAlignment = PFO_LEFT
- item.bKeepYPos = False
- item.bBorderLeft = False
- item.bBorderRight = False
- item.bBorderTop = False
- item.bBorderBottom = False
- item.bNewPage = False
- uiErr = PfoItemArrayAdd(PFO.ItemArrayBody, item)
- If uiErr Then Exit Sub
- item.uiYOffs = 100
- item.uiXOffs = 0
- item.uiWidth = 2000
- item.uiHeight = 0
- item.uiType = PFO_FIXSTR
- item.acFixStr = "HorzTitl 1"
- item.uiFontIdx = 1
- item.uiAlignment = PFO_LEFT
- item.bKeepYPos = True
- item.bBorderLeft = False
- item.bBorderRight = False
- item.bBorderTop = False
- item.bBorderBottom = True
- item.bNewPage = False
- uiErr = PfoItemArrayAdd(PFO.ItemArrayBody, item)
- If uiErr Then Exit Sub
- item.uiYOffs = 0
- item.uiXOffs = 600
- item.uiWidth = 2000
- item.uiHeight = 0
- item.uiType = PFO_FIXSTR
- item.acFixStr = "HorzTitl 2"
- item.uiFontIdx = 1
- item.uiAlignment = PFO_LEFT
- item.bKeepYPos = True
- item.bBorderLeft = False
- item.bBorderRight = False
- item.bBorderTop = False
- item.bBorderBottom = True
- item.bNewPage = False
- uiErr = PfoItemArrayAdd(PFO.ItemArrayBody, item)
- If uiErr Then Exit Sub
- item.uiYOffs = 0
- item.uiXOffs = 1200
- item.uiWidth = 2000
- item.uiHeight = 0
- item.uiType = PFO_FIXSTR
- item.acFixStr = "HorzTitl 3"
- item.uiFontIdx = 1
- item.uiAlignment = PFO_LEFT
- item.bKeepYPos = False
- item.bBorderLeft = False
- item.bBorderRight = False
- item.bBorderTop = False
- item.bBorderBottom = True
- item.bNewPage = False
- uiErr = PfoItemArrayAdd(PFO.ItemArrayBody, item)
- If uiErr Then Exit Sub
- item.uiYOffs = 10
- item.uiXOffs = 0
- item.uiWidth = 2000
- item.uiHeight = 0
- item.uiType = PFO_FIXSTR
- item.acFixStr = "HorzItem 1"
- item.uiFontIdx = 0
- item.uiAlignment = PFO_LEFT
- item.bKeepYPos = True
- item.bBorderLeft = False
- item.bBorderRight = False
- item.bBorderTop = False
- item.bBorderBottom = False
- item.bNewPage = False
- uiErr = PfoItemArrayAdd(PFO.ItemArrayBody, item)
- If uiErr Then Exit Sub
- item.uiYOffs = 0
- item.uiXOffs = 600
- item.uiWidth = 2000
- item.uiHeight = 0
- item.uiType = PFO_FIXSTR
- item.acFixStr = "HorzItem 2"
- item.uiFontIdx = 0
- item.uiAlignment = PFO_LEFT
- item.bKeepYPos = True
- item.bBorderLeft = False
- item.bBorderRight = False
- item.bBorderTop = False
- item.bBorderBottom = False
- item.bNewPage = False
- uiErr = PfoItemArrayAdd(PFO.ItemArrayBody, item)
- If uiErr Then Exit Sub
- item.uiYOffs = 0
- item.uiXOffs = 1200
- item.uiWidth = 2000
- item.uiHeight = 0
- item.uiType = PFO_FIXSTR
- item.acFixStr = "HorzItem 3"
- item.uiFontIdx = 0
- item.uiAlignment = PFO_LEFT
- item.bKeepYPos = False
- item.bBorderLeft = False
- item.bBorderRight = False
- item.bBorderTop = False
- item.bBorderBottom = False
- item.bNewPage = False
- uiErr = PfoItemArrayAdd(PFO.ItemArrayBody, item)
- If uiErr Then Exit Sub
- For iIndex = 1 To 12
- item.uiYOffs = 100
- item.uiXOffs = 0
- item.uiWidth = 500
- item.uiHeight = 0
- item.uiType = PFO_FIXSTR
- item.acFixStr = "Label"
- item.uiFontIdx = 1
- item.uiAlignment = PFO_RIGHT
- item.bKeepYPos = True
- item.bBorderLeft = False
- item.bBorderRight = False
- item.bBorderTop = False
- item.bBorderBottom = False
- item.bNewPage = False
- uiErr = PfoItemArrayAdd(PFO.ItemArrayBody, item)
- If uiErr Then Exit Sub
- item.uiYOffs = 0
- item.uiXOffs = 550
- item.uiWidth = 2000 - 550
- item.uiHeight = 0
- item.uiType = PFO_FIXSTR
- item.acFixStr = cszShortText
- item.uiFontIdx = 0
- item.uiAlignment = 0
- item.bKeepYPos = PFO_LEFT
- item.bBorderLeft = False
- item.bBorderRight = False
- item.bBorderTop = False
- item.bBorderBottom = False
- item.bNewPage = False
- If iIndex Mod 6 = 0 Then
- item.acFixStr = cszLongText
- End If
- uiErr = PfoItemArrayAdd(PFO.ItemArrayBody, item)
- If uiErr Then Exit Sub
- Next iIndex
- item.uiYOffs = 0
- item.uiXOffs = 0
- item.uiWidth = 500
- item.uiHeight = 0
- item.uiType = PFO_FIXSTR
- item.acFixStr = "ColHead 1"
- item.uiFontIdx = 1
- item.uiAlignment = PFO_LEFT
- item.bKeepYPos = True
- item.bBorderLeft = True
- item.bBorderRight = True
- item.bBorderTop = True
- item.bBorderBottom = True
- item.bNewPage = True
- uiErr = PfoItemArrayAdd(PFO.ItemArrayBody, item)
- If uiErr Then Exit Sub
- item.uiYOffs = 0
- item.uiXOffs = 500
- item.uiWidth = 500
- item.uiHeight = 0
- item.uiType = PFO_FIXSTR
- item.acFixStr = "ColHead 2"
- item.uiFontIdx = 1
- item.uiAlignment = PFO_CENTER
- item.bKeepYPos = True
- item.bBorderLeft = True
- item.bBorderRight = True
- item.bBorderTop = True
- item.bBorderBottom = True
- item.bNewPage = False
- uiErr = PfoItemArrayAdd(PFO.ItemArrayBody, item)
- If uiErr Then Exit Sub
- item.uiYOffs = 0
- item.uiXOffs = 1000
- item.uiWidth = 500
- item.uiHeight = 0
- item.uiType = PFO_FIXSTR
- item.acFixStr = "ColHead 3"
- item.uiFontIdx = 1
- item.uiAlignment = PFO_RIGHT
- item.bKeepYPos = False
- item.bBorderLeft = True
- item.bBorderRight = True
- item.bBorderTop = True
- item.bBorderBottom = True
- item.bNewPage = False
- uiErr = PfoItemArrayAdd(PFO.ItemArrayBody, item)
- If uiErr Then Exit Sub
- For iRows = 1 To 2 * iOuterLoop
- item.uiYOffs = 0
- item.uiXOffs = 0
- item.uiWidth = 500
- item.uiHeight = 0
- item.uiType = PFO_FIXSTR
- item.acFixStr = "ColRow 1"
- item.uiFontIdx = 0
- item.uiAlignment = PFO_LEFT
- item.bKeepYPos = True
- item.bBorderLeft = True
- item.bBorderRight = True
- item.bBorderTop = True
- item.bBorderBottom = True
- item.bNewPage = False
- uiErr = PfoItemArrayAdd(PFO.ItemArrayBody, item)
- If uiErr Then Exit Sub
- item.uiYOffs = 0
- item.uiXOffs = 500
- item.uiWidth = 500
- item.uiHeight = 0
- item.uiType = PFO_FIXSTR
- item.acFixStr = "ColRow 2"
- item.uiFontIdx = 0
- item.uiAlignment = PFO_CENTER
- item.bKeepYPos = True
- item.bBorderLeft = True
- item.bBorderRight = True
- item.bBorderTop = True
- item.bBorderBottom = True
- item.bNewPage = False
- uiErr = PfoItemArrayAdd(PFO.ItemArrayBody, item)
- If uiErr Then Exit Sub
- item.uiYOffs = 0
- item.uiXOffs = 1000
- item.uiWidth = 500
- item.uiHeight = 0
- item.uiType = PFO_FIXSTR
- item.acFixStr = "ColRow 3"
- item.uiFontIdx = 0
- item.uiAlignment = PFO_RIGHT
- item.bKeepYPos = False
- item.bBorderLeft = True
- item.bBorderRight = True
- item.bBorderTop = True
- item.bBorderBottom = True
- item.bNewPage = False
- uiErr = PfoItemArrayAdd(PFO.ItemArrayBody, item)
- If uiErr Then Exit Sub
- Next iRows
- Skip:
- Next iOuterLoop
- uiErr = PfoInit(PFO)
- If uiErr Then Exit Sub
- End Sub
-